package com.gr.labbackend.controller.manage.material;

import com.alibaba.fastjson.JSONObject;
import com.gr.labbackend.service.manage.material.MaterialAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class MaterialAddController {

    @Autowired
    private MaterialAddService materialAddService;

    @PostMapping("/api/manage/material/add-material")
    public JSONObject materialAdd(@RequestParam("title") String title,
                                  @RequestParam(value = "file", required = false) MultipartFile file) {
        return materialAddService.materialAdd(title, file);
    }

}
